package ${groupId}.${artifactIdProjectPackageName}.exception;


import ${groupId}.${artifactIdProjectPackageName}.common.result.ErrorCode;
import ${groupId}.${artifactIdProjectPackageName}.common.result.ResultSet;

public class ServiceException extends RuntimeException {

    private ResultSet resultSet;

    public ServiceException(ErrorCode errorCode, String msg) {
        this.resultSet = ResultSet.builderFail(errorCode, msg);
    }

    public ServiceException(ResultSet resultSet) {
        this.resultSet = resultSet;
    }

    public ServiceException(ErrorCode errorCode, String msg,Object data) {
        this.resultSet = ResultSet.builderFail(errorCode, msg);
        this.resultSet.setData(data);
    }

    public ServiceException(ErrorCode errorCode) {
        this.resultSet = ResultSet.builderFail(errorCode,errorCode.getMsg());
    }

    public ResultSet getResultSet() {
        return resultSet;
    }

    public void setResultSet(ResultSet resultSet) {
        this.resultSet = resultSet;
    }
}
